#ifndef __LENGTHUNIT_H__
#define __LENGTHUNIT_H__

#include <string>
#include <iostream>


typedef int Amount;

struct LengthUnit
{
    struct UnitSeqVistor
    {
        virtual void
        access(const LengthUnit*) = 0;
    };

    static const LengthUnit&
    getMILE();

    static const LengthUnit&
    getYARD();

    static const LengthUnit&
    getFEET();

    static const LengthUnit&
    getINCH();

    static const LengthUnit&
    getBaseUnit();

    static void
    vistorUnitSeq(UnitSeqVistor&);

    Amount
    convertToBaseUnit(const Amount &) const;

    Amount
    convertFromBaseUnit(const Amount& amountInBase) const;

    Amount
    convertOddmentFromBaseUnit(const Amount& amountInBase) const;

    bool
    operator>(const LengthUnit&) const;

    friend std::ostream&
    operator<<(std::ostream&, const LengthUnit&);

private:
    LengthUnit(const Amount&, const std::string&);

    Amount factor_m;

    const std::string name_m;
};

std::ostream&
operator<<(std::ostream&, const LengthUnit&);

#define MILE LengthUnit::getMILE()
#define YARD LengthUnit::getYARD()
#define FEET LengthUnit::getFEET()
#define INCH LengthUnit::getINCH()

#endif

